GtkWindow: Avoid a critical in F10 handling
authorMatthias Clasen <mclasen@redhat.com>
Sat, 26 Apr 2014 02:07:13 +0000 (22:07 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 26 Apr 2014 02:12:05 +0000 (22:12 -0400)
The focus widget might be NULL, and we were forgetting to take
that possibility into account in one place.

gtk/gtkwindow.c

index b6f6997f34b72206fb58d09ce1cc4bc0b68485b2..bd060c3a1fe5b02d4d43432c29906d287d9e1b8b 100644 (file)
@@ -11618,9 +11618,12 @@ gtk_window_activate_menubar (GtkWindow   *window,
       GList *tmp_menubars;
       GList *menubars;
       GtkMenuShell *menu_shell;
+      GtkWidget *focus;
+
+      focus = gtk_window_get_focus (window);
 
       if (priv->title_box != NULL &&
-          !gtk_widget_is_ancestor (gtk_window_get_focus (window), priv->title_box) &&
+          (focus == NULL || !gtk_widget_is_ancestor (focus, priv->title_box)) &&
           gtk_widget_child_focus (priv->title_box, GTK_DIR_TAB_FORWARD))
         return TRUE;